package conversion;

import java.util.List;

public class DBDataSet {
	
	private List rows;
	public String[] columns;
	
	public DBDataSet(List _rows, String[] _columns)
	{
		rows = _rows;
		columns = _columns;
	}
	
	public int length()
	{
		int ret = 0;
			ret = rows.size();
		
		return ret;
	}
	
	public Object getData(int row, String columnname)
	{
		Object obj = null;
		
				List therow = (List) rows.get(row);
			
			obj = therow.get(getColumnindex(columnname));
		
		
		return obj;
	}
	
	private int getColumnindex(String columnname)
	{
		int index = -1;
		
		for (int i=0;i<this.columns.length;i++)
		{
			if (columns[i].equals(columnname))
					index = i;
		}
			
		return index;
	}
	
	public String toString(){
		String returnString = columns.toString() + rows.toString();
		
		return returnString;
	}
}
